package com.qvtu.springboot.mapper;

import com.qvtu.springboot.entity.Admin;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

public interface AdminMapper {

    @Insert("insert into `admin` (username,password,name,role,avatar)"+
    "values (#{username},#{password},#{name},#{role},#{avatar})")
    void insert(Admin admin);

    @Select("select * from `admin` where username=#{username}")
    Admin selectByUsername(String username);

    @Delete("delete from `admin` where id=#{id}")
    void deleteById(Integer id);

    @Update("update `admin` set username=#{username},password=#{password},name=#{name},avatar=#{avatar} where id=#{id}")
    void update(Admin admin);

    @Select("select * from `admin` where id=#{id}")
    Admin selectById(Integer id);

    List<Admin> selectAll(Admin admin);

}
